<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
 * Paginator
 *
 * Função que facilita a visualização dos resultados de paginação.
 *
 * @package		Plugins
 * @author		PC4 Dev Team
 */
function paginator($pagina, $limite, $total, $base_url, $showLastAndFirst = TRUE){
	?>
<div class="paginacao" >
	<?php
	if ($pagina > 1) {
	?>
	<?php if($showLastAndFirst): ?><a href="<?php echo site_url($base_url . "1" . '/' . $limite)?>" title="Primeira P&aacute;gina">&laquo; Primeira</a><?php endif; ?><a href="<?php echo site_url($base_url . ($pagina - 1) . '/' . $limite);?>" title="P&aacute;gina Anterior">&laquo; Anterior</a>
	<?php
	}
	if($total > 1){
		//for ($i=1; $i<=$total; $i++) {
	?>
	<span><?php echo "$pagina de $total";?></span>
	<!-- <a href="<?php echo site_url($base_url . $i . '/' . $limite)?>" class="number <?php echo ($pagina == $i) ? "current" : "";?>" title="<?php echo "P&aacute;gina $i";?>"><?php echo $i;?></a>  -->
	<?php
		//}
	}
	if ($pagina < $total) {
	?>
    <a href="<?php echo site_url($base_url .($pagina + 1) . '/' . $limite);?>" title="Pr&oacute;xima P&aacute;gina">Pr&oacute;xima &raquo;</a><?php if($showLastAndFirst): ?><a href="<?php echo site_url($base_url . $total . '/' . $limite)?>" title="&Uacute;ltima P&aacute;gina">&Uacute;ltima &raquo;</a><?php endif; ?>
	<?php
	}
	?>
</div>
	<?php 
}